﻿<!DOCTYPE html>
<html>
<!-- 试题管理-编辑 -->

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="/static/js/common.js"></script>

</head>

<body>
    <div id="app"  v-cloak>
        <el-form label-position="right" ref="form" :inline="true" :model="formInline" class="demo-form-inline"
                 style="margin-bottom: 15px;">

            <el-row>
                <el-col class="head-tool" style="margin-top:15px;">
                    题目信息
                    <span>
                        <btn :text="col.btnSelect" imgsrc="/static/images/search.png" linetype="3" @click="onSubmit">
                        </btn>
                        <btn :text="col.btnAdd" linetype="3" @click="UserInput('tj')"></btn>

                        <btn-template-download tempname="ZB/总部_试题管理模板.xlsx"></btn-template-download>
                        
                        <btn-uploadfile-list   :data="{data:formInline.model.sktid}" url="/api/ZB_CourseQuestions/Import"></btn-uploadfile-list>

                        <btn-export-list url="/api/ZB_CourseQuestions/Export" :forminline="this.formInline">
                        </btn-export-list>

                        <btn :text="col.btnDelete" linetype="4" @click="onDelete"></btn>
                    </span>
                </el-col>


                <!--试题题目-->
                <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item prop="titleoftitle">
                            <el-input type="text" v-model="formInline.model.titleoftitle" autocomplete="off" size="mini">
                                <template slot="prepend">
                                    {{Coursewaremanagement.Titleoftitle+mark.m}}
                                </template>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>

                <!--题型-->
                <!--<el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input v-model="formInline.model.Questiontype" :placeholder="Coursewaremanagement.Questiontype"
                                      size="mini">
                                <template slot="prepend">
                                    {{Coursewaremanagement.Questiontype+mark.m}}
                                </template>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>-->
                <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{Coursewaremanagement.Questiontype+mark.m}}
                                </template>
                                <el-select @visible-change="visibleChange" v-model="formInline.model.questiontype" slot="suffix">
                                    <el-option label="请选择" value=""></el-option>
                                    <el-option v-for="item in QuestiontypeL" :label="item.value"
                                               :value="item.key">
                                    </el-option>
                                </el-select>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>

                <!--课题名称-->
                <!--<el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
        <div class="elst-select-mini">
            <el-form-item>
                <el-input v-model="formInline.model.Questiontype" :placeholder="Coursewaremanagement.Topicname"
                          size="mini">
                    <template slot="prepend">
                        {{Coursewaremanagement.Topicname+mark.m}}
                    </template>
                </el-input>
            </el-form-item>
        </div>
    </el-col>-->


                <el-table ref="table" stripe :data="ListItem.tableData" :row-key="getRowKeys" border
                          @selection-change="handleSelectionChange" row-style="height:10px" style="width: 100%;">
                    <el-table-column type="selection" style="
    padding-top: 0px;
    padding-bottom: 0px;
    " algin="center" width="55" :reserve-selection="true">
                    </el-table-column>
                    <!--序号-->
                    <el-table-column type="index" :label="col.SequenceNumber" :index="indexMethod" width="50"
                                     show-overflow-tooltip="true"></el-table-column>
                    <!--试题题目-->
                    <el-table-column prop="titleoftitle" :label="Coursewaremanagement.Titleoftitle"   min-width="100" show-overflow-tooltip="true" >
                    </el-table-column>
                    <!--题型-->
                    <el-table-column prop="questiontypeText" :label="Coursewaremanagement.Questiontype"  min-width="100" show-overflow-tooltip="true" >
                    </el-table-column>
                    <!--课题-->
                    <el-table-column prop="mark01" :label="Coursewaremanagement.Topicname"  min-width="100" show-overflow-tooltip="true" >
                    </el-table-column>

                    <el-table-column width="53" :label="col.btnUpdate" fixed="right">
                        <template slot-scope="scope">
                            <button type="button" class="elst-bt-xg" @click=UserInput('xg',scope.row.id)>
                                <i class="el-icon-edit"></i>
                            </button>
                        </template>
                    </el-table-column>
                </el-table>
            </el-row>
            <el-row type="flex" justify="end">
                <el-pagination ref="page" @size-change="handleSizeChange" @current-change="handleCurrentChange"
                               :current-page="ListItem.currentPage" :page-sizes="ListItem.pagesizes" :page-size="ListItem.pagesize"
                               :layout="ListItem.layout" :total="ListItem.total">
                </el-pagination>
            </el-row>
            <br>
            <el-row type="flex" justify="end">
                <el-form-item>
                    <!--<el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnSave}}</el-button>-->
                    <!--<el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnCommit}}</el-button>-->
                    <el-button type="primary" @click="parent.ListItem.dialogVisible=false">{{col.btnBack}}</el-button>
                </el-form-item>
            </el-row>
        </el-form>
        <el-dialog title="试题编辑" fullscreen="true" :visible.sync="ListItem.dialogVisible" @close='closeDialog'
                   width="80%" height="80%" top="10vh">
            <iframe ref="iframe" :src="ListItem.InputUrl" style="height:95%;width:100%" frameborder="0"></iframe>
        </el-dialog>
    </div>
    <script type="text/javascript">
        var app = new Vue({
            el: '#app',
            data: {
                //父业传参
                pageInitial: null,
                id: '',
                sbzid:'',
                value1: '',
                ListItem: ListItem,
                QuestiontypeL: [],//题型下拉列表
                formInline: {
                    model: {
                        topicname: '', trainingtype: ''
                        , Qualifiedscore: '', Scoreperitem: '', Trainingobjectives: '', Trainingmode: ''
                        , sktid: ''
                        , zB_QuestionsOptions: [],//选项从表
                    },
                    offset: 0,
                    limit: 10
                },
                //表单验证
                rules: {
                    // topicname: [
                    //     verification.NotNull
                    // ],
                    // trainingtype: [
                    //     verification.NotNull
                    // ],
                }
            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
               
                indexMethod: function (index) {
                    return (this.ListItem.currentPage - 1) * this.ListItem.pagesize + index + 1;
                },
               
                //查询方法
                onSubmit: function () { onSubmit(this); },
                btnUpLoad: function () {
                    this.$message({
                        message: '上传成功',
                        type: 'success'
                    });
                },
                //删除方法
                onDelete: function () { onDelete(this, '/api/ZB_CourseQuestions/DeleteMuti'); },
                //Dialog展示
                UserInput: function (val, id) { DialogShow(this, val, "CoursewaremanagementInputtQues.html", id); },
                //列表选择触发
                handleSelectionChange: function (val) { handleSelectionChange(this, val); },
                //获取分页数据
                GetPageData: function (currentIndex) {
                    //this.formInline.model.sktid = getUrlParam("id");//课题id
                    GetPageData(this, currentIndex, '/api/ZB_CourseQuestions/GetList');
                    //console.log("xxxtttxxx", this.formInline.model);
                },
                //pagesize改变 触发方法
                handleSizeChange: function (val) { handleSizeChange(this, val); },
                //跳页触发方法
                handleCurrentChange: function (val) { handleCurrentChange(this, val); },
            },
            mounted: function () {
                //初始化数据
                //列表高度自适应
                tablehigh(this);
                this.id = getUrlParam("id");
                this.sbzid = getUrlParam("id");//课题id
                this.formInline.model.sktid = getUrlParam("id");//课题id
                //alert(this.ktid);
                //获取下拉菜单内容
                ////////////////////
                this.pageInitial = PageInitial(['zbkjgltx']);//题型
                var dicDataList = this.pageInitial.dataDicList;
                //总部_课件管理_题型 0 单选题、1 多选题、2 判断题
                this.QuestiontypeL = getDicDataFodDataList(dicDataList, 'zbkjgltx');
                ////////////////////
                this.GetPageData(1);
            }

        });
    </script>
</body>

</html>